#pragma once

#include <cdroid.h>

class AdapterDataUp
{
public:
    int pos;
    ViewGroup *adapterLayout;
    std::string name;

    AdapterDataUp(int _pos, ViewGroup *_adapterLayout) : pos(_pos), adapterLayout(_adapterLayout) {};

    void display() const
    {
        std::cout << "pos: " << pos << ", adapterLayout: " << adapterLayout << std::endl;
    }
};

class MyPageAdapterUp : public PagerAdapter
{
public:
    MyPageAdapterUp();
    int getCount() override;
    bool isViewFromObject(View *view, void *object) override;
    void *instantiateItem(ViewGroup *container, int position) override;
    void destroyItem(ViewGroup *container, int position, void *object) override;
    std::string getPageTitle(int position) override;
    float getPageWidth(int position) override;
    void updateItem(int position);
    int getItemPosition(void *object) override;

    std::vector<AdapterDataUp> getDataList()
    {
        return dataList;
    }
    // Runnable myTickerForWeather;
    // int myTickerTimeForWeather = 1000 * 60 * 31; // 31分钟
    // void onTickerForWeather();

    // Runnable myTickerForDay;
    // int myTickerTimeForDay = 1000; // 1秒
    // void onTickerForDay();

private:
    std::vector<AdapterDataUp> dataList;
    ViewGroup *lunBoLayoutUp;
    TextView *temperatureNum;
    TextView *date;
    ImageView *weather;
};
